<?php
/*
 * @ControllerAnnotation(title="横幅广告模型")
 */
namespace app\admin\model;

use app\common\model\SupplyModel;
use think\Db;
use think\facade\Cache;

class SupplyBanner extends SupplyModel
{
    protected static function init()
    {
        self::afterInsert(function ($user) {
            Cache::store('redis')->set('banner',Db::table('yd_supply_banner')->select());
        });
        self::afterUpdate(function ($user) {
            Cache::store('redis')->set('banner',Db::table('yd_supply_banner')->select());
        });
        self::afterDelete(function ($user) {
            Cache::store('redis')->set('banner',Db::table('yd_supply_banner')->select());
        });
    }
}